/**
 * @author LKQ
 * @date 2022/1/30 11:40
 * @description
 */
public class FormalSolution {
    public static void main(String[] args) {

    }
    public int getDecimalValue(ListNode head) {
        ListNode curNode = head;
        int ans = 0;
        while (curNode != null) {
            ans = ans * 2 + curNode.val;
            curNode = curNode.next;
        }
        return ans;
    }
}
